/**
 *  iBizSys 5.0 机器人生产代码（不要直接修改当前代码）
 *  http://www.ibizsys.net
 */
package com.sa.ibiz.demo.srv.demo.service;


import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Component;
import net.ibizsys.paas.exception.ErrorException;
import net.ibizsys.paas.core.PluginActionResult;
import net.ibizsys.paas.core.IDataEntity;
import net.ibizsys.paas.core.IDEDataSetFetchContext;
import net.ibizsys.paas.db.DBCallResult;
import net.ibizsys.paas.db.DBFetchResult;
import net.ibizsys.paas.db.IProcParam;
import net.ibizsys.paas.util.StringHelper;
import net.ibizsys.paas.util.StringBuilderEx;
import net.ibizsys.paas.core.Errors;
import net.ibizsys.paas.core.ActionContext;
import net.ibizsys.paas.data.DataObject;
import net.ibizsys.paas.service.ServiceGlobal;
import net.ibizsys.paas.entity.IEntity;
import net.ibizsys.paas.demodel.IDataEntityModel;
import net.ibizsys.paas.demodel.DEModelGlobal;
import net.ibizsys.paas.demodel.IDELogicModel;
import net.ibizsys.paas.dao.DAOGlobal;
import net.ibizsys.paas.web.WebContext;
import net.ibizsys.paas.service.IService;
import net.ibizsys.paas.util.DataTypeHelper;
import net.ibizsys.paas.util.KeyValueHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import net.ibizsys.paas.db.SelectCond;
import net.ibizsys.paas.service.IServiceWork;
import net.ibizsys.paas.service.IServicePlugin;
import net.ibizsys.paas.service.ITransaction;
import net.ibizsys.paas.dao.IDAO;
import net.ibizsys.paas.service.CloneSession;
import net.ibizsys.paas.service.ServiceBase;
import net.ibizsys.paas.entity.EntityFieldError;
import net.ibizsys.paas.entity.EntityError;
import java.sql.Timestamp;
import net.ibizsys.paas.util.DefaultValueHelper;
import javax.annotation.PostConstruct;
import net.ibizsys.paas.service.IDataContextParam;
import net.sf.json.JSONObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;



import com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMERMG2;
import com.sa.ibiz.demo.srv.demo.dao.IBZ5CUSTOMERMG2DAO;
import com.sa.ibiz.demo.srv.demo.demodel.IBZ5CUSTOMERMG2DEModel;


/**
 * 实体[IBZ5CUSTOMERMG2] 服务对象基类
 */
@Component
public class IBZ5CUSTOMERMG2Service extends com.sa.ibiz.demo.srv.MyTestSysSysServiceBase<IBZ5CUSTOMERMG2> {
    private static final Log log = LogFactory.getLog(IBZ5CUSTOMERMG2Service.class);
    /**
     * 实体数据集合[DEFAULT]标识
     */
    public final static String DATASET_DEFAULT = "DEFAULT";


    public IBZ5CUSTOMERMG2Service () {
        super();

    }

    /**
     * 获取实体[IBZ5CUSTOMERMG2]服务对象
     * @param sessionFactory
     * @return
     * @throws Exception
     */
    public static IBZ5CUSTOMERMG2Service getInstance() throws Exception {
        return getInstance(null);
    }

    /**
     * 获取实体[IBZ5CUSTOMERMG2]服务对象
     * @param sessionFactory
     * @return
     * @throws Exception
     */
    public static IBZ5CUSTOMERMG2Service getInstance(SessionFactory sessionFactory) throws Exception {
        return (IBZ5CUSTOMERMG2Service)ServiceGlobal.getService(IBZ5CUSTOMERMG2Service.class, sessionFactory);
    }

    /**
     * Spring注册后执行构造处理
     * @throws Exception
     */
    @PostConstruct
    public void postConstruct() throws Exception {
        ServiceGlobal.registerService(getServiceId(), this);
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getServiceId()
     */
    @Override
    protected String getServiceId() {
        return "com.sa.ibiz.demo.srv.demo.service.IBZ5CUSTOMERMG2Service";
    }

    private IBZ5CUSTOMERMG2DEModel iBZ5CUSTOMERMG2DEModel;
    /**
     * 获取实体[IBZ5CUSTOMERMG2]模型对象
     */
    public  IBZ5CUSTOMERMG2DEModel getIBZ5CUSTOMERMG2DEModel() {
        if(this.iBZ5CUSTOMERMG2DEModel==null) {
            try {
                this.iBZ5CUSTOMERMG2DEModel = (IBZ5CUSTOMERMG2DEModel)DEModelGlobal.getDEModel("com.sa.ibiz.demo.srv.demo.demodel.IBZ5CUSTOMERMG2DEModel");
            } catch(Exception ex) {
            }
        }
        return this.iBZ5CUSTOMERMG2DEModel;
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getDEModel()
     */
    @Override
    public  IDataEntityModel getDEModel() {
        return this.getIBZ5CUSTOMERMG2DEModel();
    }


    private IBZ5CUSTOMERMG2DAO iBZ5CUSTOMERMG2DAO;

    /**
     * 获取实体[IBZ5CUSTOMERMG2]数据操作对象
     */
    public  IBZ5CUSTOMERMG2DAO getIBZ5CUSTOMERMG2DAO() {
        if(this.iBZ5CUSTOMERMG2DAO==null) {
            try {
                this.iBZ5CUSTOMERMG2DAO= (IBZ5CUSTOMERMG2DAO)DAOGlobal.getDAO("com.sa.ibiz.demo.srv.demo.dao.IBZ5CUSTOMERMG2DAO",this.getSessionFactory());
            } catch(Exception ex) {
            }
        }
        return this.iBZ5CUSTOMERMG2DAO;
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.IService#getDAO()
     */
    @Override
    public  IDAO getDAO() {
        return this.getIBZ5CUSTOMERMG2DAO();
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onfetchDataSet(java.lang.String, net.ibizsys.paas.core.IDEDataSetFetchContext)
     */
    @Override
    protected DBFetchResult onfetchDataSet(String strDataSetName,IDEDataSetFetchContext iDEDataSetFetchContext) throws Exception {
        if(StringHelper.compare(strDataSetName,DATASET_DEFAULT,true)==0) {
            return this.fetchDefault(iDEDataSetFetchContext);
        }
        return super.onfetchDataSet(strDataSetName,iDEDataSetFetchContext);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onExecuteAction(java.lang.String, net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected  void onExecuteAction(String strAction,IEntity entity) throws Exception {
        super.onExecuteAction(strAction,entity);
    }

    /**
     * 获取数据集合[DEFAULT]
     * @param iDEDataSetFetchContext
     * @return
     * @throws Exception
     */
    public DBFetchResult fetchDefault(IDEDataSetFetchContext iDEDataSetFetchContext) throws Exception {

        DBFetchResult dbFetchResult =  doServiceFetchWork(iDEDataSetFetchContext,DATASET_DEFAULT,false);
        // dbFetchResult.getDataSet().cacheDataRow();
        // session.close();
        return dbFetchResult;
    }







    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onFillParentInfo(net.ibizsys.paas.entity.IEntity, java.lang.String, java.lang.String, java.lang.String)
     */
    @Override
    protected void onFillParentInfo(IBZ5CUSTOMERMG2 et,String strParentType,String strTypeParam,String strParentKey) throws Exception {
        super.onFillParentInfo(et,strParentType,strTypeParam,strParentKey);
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncDER1NData(java.lang.String, java.lang.String, java.lang.String)
     */
    @Override
    protected String onSyncDER1NData(String strDER1NId, String strParentKey, String strDatas) throws Exception {
        return super.onSyncDER1NData( strDER1NId,  strParentKey,  strDatas);
    }





    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onFillEntityFullInfo(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onFillEntityFullInfo(IBZ5CUSTOMERMG2 et, boolean bCreate) throws Exception {
        //填充新建默认值
        if(bCreate) {
        }
        super.onFillEntityFullInfo(et, bCreate);

        //填充物理化外键相关属性
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onWriteBackParent(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onWriteBackParent(IBZ5CUSTOMERMG2 et, boolean bCreate) throws Exception {
        super.onWriteBackParent(et, bCreate);
    }







    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onBeforeRemove(net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected void onBeforeRemove(IBZ5CUSTOMERMG2 et) throws Exception {
        super.onBeforeRemove(et);
    }






    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onRemoveEntityUncopyValues(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onRemoveEntityUncopyValues(IBZ5CUSTOMERMG2 et, boolean bTempMode) throws Exception {
        super.onRemoveEntityUncopyValues(et,  bTempMode);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onCheckEntity(boolean, net.ibizsys.paas.entity.IEntity, boolean, boolean, net.ibizsys.paas.entity.EntityError)
     */
    @Override
    protected void onCheckEntity(boolean bBaseMode,IBZ5CUSTOMERMG2  et, boolean bCreate, boolean bTempMode,EntityError entityError) throws Exception {
        EntityFieldError entityFieldError = null;
        super.onCheckEntity(bBaseMode,et,  bCreate,bTempMode,entityError);
    }




    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncEntity(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onSyncEntity(IBZ5CUSTOMERMG2 et, boolean bRemove) throws Exception {
        super.onSyncEntity( et,  bRemove);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onSyncIndexEntities(net.ibizsys.paas.entity.IEntity, boolean)
     */
    @Override
    protected void onSyncIndexEntities(IBZ5CUSTOMERMG2 et,boolean bRemove) throws Exception {
        super.onSyncIndexEntities(et,bRemove);
    }


    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#getDataContextValue(net.ibizsys.paas.entity.IEntity, java.lang.String, net.ibizsys.paas.service.IDataContextParam)
     */
    @Override
    public Object getDataContextValue(IBZ5CUSTOMERMG2 et,String strField,IDataContextParam iDataContextParam)throws Exception {
        Object objValue = null;
        if(iDataContextParam!=null) {
        }

        objValue = super.getDataContextValue(et,strField,iDataContextParam);
        if(objValue!=null)
            return objValue;

        return null;
    }



    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onTestValueRule(java.lang.String, java.lang.String, net.ibizsys.paas.entity.IEntity, boolean, boolean)
     */
    @Override
    protected String onTestValueRule(String strDEFieldName,String strRule,IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        if((StringHelper.compare(strDEFieldName,IBZ5CUSTOMERMG2.FIELD_BANKACCOUNTNUM,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_BANKACCOUNTNUM_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5CUSTOMERMG2.FIELD_BANKNAME,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_BANKNAME_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5CUSTOMERMG2.FIELD_IBZ5CUSTOMERNAME,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5CUSTOMERName_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5CUSTOMERMG2.FIELD_ADDRESS,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_ADDRESS_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5CUSTOMERMG2.FIELD_IBZ5CUSTOMERID,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_IBZ5CUSTOMERId_Default(et,bCreate,bTempMode);
        if((StringHelper.compare(strDEFieldName,IBZ5CUSTOMERMG2.FIELD_CUSTOMERUID,true)==0)
                &&(StringHelper.compare(strRule,"DEFAULT",true)==0))
            return onTestValueRule_CUSTOMERUID_Default(et,bCreate,bTempMode);

        return super.onTestValueRule( strDEFieldName, strRule, et,bCreate, bTempMode);
    }

    /**
     * 判断值规则[开户银行号][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_BANKACCOUNTNUM_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("BANKACCOUNTNUM", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[开户行][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_BANKNAME_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("BANKNAME", et, bTempMode,null,false,200,true,"内容长度必须小于等于[200]")))
                return null;
            return "内容长度必须小于等于[200]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[客户名称][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5CUSTOMERName_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5CUSTOMERNAME", et, bTempMode,null,false,200,true,"内容长度必须小于等于[200]")))
                return null;
            return "内容长度必须小于等于[200]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[地址][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_ADDRESS_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("ADDRESS", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[客户标识][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_IBZ5CUSTOMERId_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("IBZ5CUSTOMERID", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }

    /**
     * 判断值规则[客户编号][默认规则]
     * @param et 当前数据对象
     * @param bCreate 是否为新建数据模式
     * @param bTempMode 是否为临时数据模式
     * @return
     * @throws Exception
     */
    protected String onTestValueRule_CUSTOMERUID_Default(IEntity et,boolean bCreate,boolean bTempMode) throws Exception {
        try {
            if((checkFieldStringLengthRule("CUSTOMERUID", et, bTempMode,null,false,100,true,"内容长度必须小于等于[100]")))
                return null;
            return "内容长度必须小于等于[100]";
        } catch(Exception ex) {
            return ex.getMessage();
        }
    }



    /* (non-Javadoc)
     * @see net.ibizsys.paas.service.ServiceBase#onMergeChild(java.lang.String, java.lang.String, net.ibizsys.paas.entity.IEntity)
     */
    @Override
    protected boolean onMergeChild(String strChildType, String strTypeParam, IBZ5CUSTOMERMG2 et) throws Exception {
        boolean bRet = false;
        if(super.onMergeChild( strChildType, strTypeParam,  et))
            bRet = true;
        return bRet;
    }



    /**
     * 更新父数据
     * @param et
     * @throws Exception
     */
    @Override
    protected void onUpdateParent(IBZ5CUSTOMERMG2 et)throws Exception {
        super.onUpdateParent(et);
    }


    /**
     * 内部建立数据
     * @param entity
     * @throws Exception
     */
    @Override
    protected void internalCreate( IBZ5CUSTOMERMG2 et) throws Exception {
        //获取主键
        Object objKey = et.getIBZ5CUSTOMERId();
        //建立主实体[IBZ5ACCOUNT]数据
        if(true) {
            IService service  = ServiceGlobal.getService(com.sa.ibiz.demo.srv.demo.service.IBZ5ACCOUNTService.class,getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT entity = new com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT();
            if(et.isBANKACCOUNTNUMDirty()) {
                entity.setBANKACCOUNTNUM(et.getBANKACCOUNTNUM());
            }
            if(et.isBANKNAMEDirty()) {
                entity.setBANKNAME(et.getBANKNAME());
            }
            //设置主键
            entity.set("IBZ5ACCOUNTID",objKey);
            service.create(entity,false);
        }
        //建立主实体[IBZ5CUSTOMER]数据
        if(true) {
            IService service  = ServiceGlobal.getService(com.sa.ibiz.demo.srv.demo.service.IBZ5CUSTOMERService.class,getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER entity = new com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER();
            if(et.isADDRESSDirty()) {
                entity.setADDRESS(et.getADDRESS());
            }
            if(et.isCUSTOMERUIDDirty()) {
                entity.setCUSTOMERUID(et.getCUSTOMERUID());
            }
            if(et.isIBZ5CUSTOMERIdDirty()) {
                entity.setIBZ5CUSTOMERId(et.getIBZ5CUSTOMERId());
            }
            if(et.isIBZ5CUSTOMERNameDirty()) {
                entity.setIBZ5CUSTOMERName(et.getIBZ5CUSTOMERName());
            }
            //设置主键
            entity.set("IBZ5CUSTOMERID",objKey);
            service.create(entity,false);
        }
    }

    /**
     * 内部更新数据
     * @param entity
     * @throws Exception
     */
    @Override
    protected void internalUpdate( IBZ5CUSTOMERMG2 et) throws Exception {
        //获取主键
        Object objKey = et.getIBZ5CUSTOMERId();
        //更新主实体[IBZ5ACCOUNT]数据
        if(true) {
            IService service  = ServiceGlobal.getService(com.sa.ibiz.demo.srv.demo.service.IBZ5ACCOUNTService.class,getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT entity = new com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT();
            if(et.isBANKACCOUNTNUMDirty()) {
                entity.setBANKACCOUNTNUM(et.getBANKACCOUNTNUM());
            }
            if(et.isBANKNAMEDirty()) {
                entity.setBANKNAME(et.getBANKNAME());
            }
            //设置主键
            entity.set("IBZ5ACCOUNTID",objKey);
            service.update(entity,false);
        }
        //更新主实体[IBZ5CUSTOMER]数据
        if(true) {
            IService service  = ServiceGlobal.getService(com.sa.ibiz.demo.srv.demo.service.IBZ5CUSTOMERService.class,getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER entity = new com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER();
            if(et.isADDRESSDirty()) {
                entity.setADDRESS(et.getADDRESS());
            }
            if(et.isCUSTOMERUIDDirty()) {
                entity.setCUSTOMERUID(et.getCUSTOMERUID());
            }
            if(et.isIBZ5CUSTOMERIdDirty()) {
                entity.setIBZ5CUSTOMERId(et.getIBZ5CUSTOMERId());
            }
            if(et.isIBZ5CUSTOMERNameDirty()) {
                entity.setIBZ5CUSTOMERName(et.getIBZ5CUSTOMERName());
            }
            //设置主键
            entity.set("IBZ5CUSTOMERID",objKey);
            service.update(entity,false);
        }
    }

    /**
     * 内部系统更新数据
     * @param entity
     * @throws Exception
     */
    @Override
    protected void internalSysUpdate( IBZ5CUSTOMERMG2 et) throws Exception {
        //获取主键
        Object objKey = et.getIBZ5CUSTOMERId();
        //系统更新主实体[IBZ5ACCOUNT]数据
        if(true) {
            IService service  = ServiceGlobal.getService(com.sa.ibiz.demo.srv.demo.service.IBZ5ACCOUNTService.class,getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT entity = new com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT();
            if(et.isBANKACCOUNTNUMDirty()) {
                entity.setBANKACCOUNTNUM(et.getBANKACCOUNTNUM());
            }
            if(et.isBANKNAMEDirty()) {
                entity.setBANKNAME(et.getBANKNAME());
            }
            //设置主键
            entity.set("IBZ5ACCOUNTID",objKey);
            service.sysUpdate(entity,false);
        }
        //系统更新主实体[IBZ5CUSTOMER]数据
        if(true) {
            IService service  = ServiceGlobal.getService(com.sa.ibiz.demo.srv.demo.service.IBZ5CUSTOMERService.class,getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER entity = new com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER();
            if(et.isADDRESSDirty()) {
                entity.setADDRESS(et.getADDRESS());
            }
            if(et.isCUSTOMERUIDDirty()) {
                entity.setCUSTOMERUID(et.getCUSTOMERUID());
            }
            if(et.isIBZ5CUSTOMERIdDirty()) {
                entity.setIBZ5CUSTOMERId(et.getIBZ5CUSTOMERId());
            }
            if(et.isIBZ5CUSTOMERNameDirty()) {
                entity.setIBZ5CUSTOMERName(et.getIBZ5CUSTOMERName());
            }
            //设置主键
            entity.set("IBZ5CUSTOMERID",objKey);
            service.sysUpdate(entity,false);
        }
    }

    /**
     * 内部删除数据
     * @param entity
     * @throws Exception
     */
    @Override
    protected void internalRemove( IBZ5CUSTOMERMG2 et) throws Exception {
        //获取主键
        Object objKey = et.getIBZ5CUSTOMERId();
        //删除主实体[IBZ5CUSTOMER]数据
        if(true) {
            IService service  = ServiceGlobal.getService(com.sa.ibiz.demo.srv.demo.service.IBZ5CUSTOMERService.class,getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER entity = new com.sa.ibiz.demo.srv.demo.entity.IBZ5CUSTOMER();
            //设置主键
            entity.set("IBZ5CUSTOMERID",objKey);
            service.remove(entity);
        }
        //删除主实体[IBZ5ACCOUNT]数据
        if(true) {
            IService service  = ServiceGlobal.getService(com.sa.ibiz.demo.srv.demo.service.IBZ5ACCOUNTService.class,getSessionFactory());
            com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT entity = new com.sa.ibiz.demo.srv.demo.entity.IBZ5ACCOUNT();
            //设置主键
            entity.set("IBZ5ACCOUNTID",objKey);
            service.remove(entity);
        }
    }
}